<?php

if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER ['HTTP_X_REQUESTED_WITH']  == 'XMLHttpRequest') {
	require('../../../../wp-config.php');
	auth_redirect();

	if($_GET["action"] == 'rescan')
		if($message = canvas_reload()) echo '<p>The Canvas block and plugin directories were successfully scanned.</p>'."\n".$message;
			else echo '<p>An error was encountered while rescanning. Please notify Canvas <a href="http://forums.freshpursuits.com/">support</a>.</p>';
	if($_GET["action"] == 'reinstall') 
		if(canvas_clean_install()) echo '<p>Canvas has been successfully reinstalled.</p>';
			else echo '<p>An error was encountered during installation. Please notify Canvas <a href="http://forums.freshpursuits.com/">support</a>.</p>';
	if($_GET["action"] == 'restore') 
		if(canvas_install_options()) echo '<p>Canvas defaults have been restored.</p>';
			else echo '<p>An error was encountered during restoration. Please notify Canvas <a href="http://forums.freshpursuits.com/">support</a>.</p>';
}
?>